package com.lfs.base.enums;

import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum ImageTypeEnums {
    BASE_IMAGE("1","主图"),
    OPTION_IMAGE("2","选项图"),
    DETAIL_IMAGE("3","详情图");

    private String code;

    private String description;


    private static final Map<String,Object> lookMap = new HashMap<>();
    private static final Map<String,String> lookCodeMap = new HashMap<>();

    static {
        for (ImageTypeEnums e : EnumSet.allOf(ImageTypeEnums.class)){
            lookMap.put(e.getCode(),e);
        }
        for (ImageTypeEnums e : EnumSet.allOf(ImageTypeEnums.class)){
            lookCodeMap.put(e.getDescription(),e.code);
        }
    }


    public String getCode(){return code;}

    public String getDescription(){return description;}

    ImageTypeEnums(String code, String description){
        this.code = code;
        this.description = description;
    }

    // 提供获取lookCodeMap的方法
    public static Map<String, String> getLookCodeMap() {
        // 返回不可变的映射，防止外部修改
        return Collections.unmodifiableMap(lookCodeMap);
    }
}
